﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;


public partial class Empresa : System.Web.UI.Page
{
    //creamos el dataset que contendra las tablas
    DataSet ds = new DataSet();
    String User;
    protected void Page_Load(object sender, EventArgs e)
    {
        //llenamos el dataset con los datos de la tablas de empresas
        Emp.Empresas em = new Emp.Empresas();
        ds = em.ConsultaEmpresa();
       
        if (Session["iduser"] == null || Session["iduser"].ToString() == "0")
        {
            Response.Redirect("index.aspx");
        }
        else
        {
            User = (string)(Session["iduser"]);
            lblses.Text = "Bienvenido " + (string)(Session["Ncom"]);


        }
    }
    //-----------------------------------------------------------------------------------------------------------
    protected void imgbtnEm_Click(object sender, ImageClickEventArgs e)
    {

        //creamos el objeto tabla para llenar una nueva fila
        DataTable Temp = ds.Tables["Empresas"];
        DataRow row = Temp.NewRow();

        //ingrasamos los datos de la fila
        row["IdEmpresa"] = User;
        row["Nombre"] = txtEmpNombre.Text;
        row["NombreComercial"] = txtEmpNombCom.Text;
        row["NoRegistro"] = txtEmpNumReg.Text;
        row["CodigoTributario"] = txtEmpCodT.Text;
        row["Giro"] = txtEmpGiro.Text;
        row["Direccion"] = txtEmpDir.Text;
        row["Telefono"] = txtEmpTel.Text;
        row["Fax"] = txtEmpFax.Text;
        row["Contacto"] = txtEmpNC.Text;
        row["WWW"] = txtEmpPagW.Text;
        row["Email"] = txtEmpEmail.Text;
        row["Descripcion"] = txtEmpDes.Text;
        row["IdIndustria"] = cmbindustria.SelectedValue;
        row["IdPais"] = cmbpais.SelectedValue;
        row["IdOutsourcing"] = 1;

        ds.Tables["Empresas"].Rows.Add(row);

        Emp.Empresas cl = new Emp.Empresas();
        cl.DatoEmpresas(ds);
        ds.AcceptChanges();
        lblsave.Text = "Datos Guardados";
    }
    //-----------------------------------------------------------------------------------------------------------
    /*void llenarficha()
    {
        DataTable Temp = ds.Tables["Empresas"];

        row["IdEmpresa"] = User;
        row["Nombre"] = txtEmpNombre.Text;
        row["NombreComercial"] = txtEmpNombCom.Text;
        row["NoRegistro"] = txtEmpNumReg.Text;
        row["CodigoTributario"] = txtEmpCodT.Text;
        row["Giro"] = txtEmpGiro.Text;
        row["Direccion"] = txtEmpDir.Text;
        row["Telefono"] = txtEmpTel.Text;
        row["Fax"] = txtEmpFax.Text;
        row["Contacto"] = txtEmpNC.Text;
        row["WWW"] = txtEmpPagW.Text;
        row["Email"] = txtEmpEmail.Text;
        row["Descripcion"] = txtEmpDes.Text;
        row["IdIndustria"] = cmbindustria.SelectedValue;
        row["IdPais"] = cmbpais.SelectedValue;
    
    }
 */
}